package com.lianqi.emcpframework.design.support.aggregate;

import com.lianqi.emcpframework.design.domain.aggregate.Aggregate;
import com.lianqi.emcpframework.design.domain.aggregate.AggregateEvent;
import com.lianqi.emcpframework.design.support.event.AbstractDomainEvent;

/**
 * @program emcp-framework
 * @ClassName AbstractAggregateEvent
 * @description: 抽象聚合根事件
 * @author: sky
 * @create: 2019/06/12 14:29
 */
public abstract class AbstractAggregateEvent<ID, T, A extends Aggregate<T, ID>> extends AbstractDomainEvent
    implements AggregateEvent<ID, T, A> {

    private final A source;

    /**
     * @param source
     *            事件源
     * @throws @Description:
     *             构造方法
     */
    public AbstractAggregateEvent(A source) {
        this.source = source;
    }

    public AbstractAggregateEvent(String id, A source) {
        super(id);
        this.source = source;

    }

    @Override
    public A source() {
        return this.source;
    }

}
